home *** CD-ROM | disk | FTP | other *** search
- ## ftp_get.tg
- # file Get
- # script assumes:
- # 1. There is a temp/foo/test_file.dat file on the remote server.
- # 2. There is a c:\temp\foo local directory.
- # 3. the environment variables: USER.SERVER, USER.USERID, and USER.PASSWORD are set elsewhere,
- # perhaps in the global (computer) environment or the local environment of WinCron via
- # Config.tg or AutoRun.tg. You could also set them here in this this script or hard-code the
- # values passed to -ftp connect.
-
- # get a file
- {
- -name ftp_get
- -start
- -stop
- -action -print connecting to remote ftp server
- -action -onerror connect_fail
- -action -ftp connect handle %USER.SERVER% 21 %USER.USERID% %USER.PASSWORD%
- -action -print getting file from remote ftp server
- -action -onerror operation_fail
- -action -ftp get handle temp/foo/test_file.dat c:\temp\foo\test_file.dat 0
- -action -ftp close handle
- -action -print done!
- }
-
- # connection failed
- {
- -name connect_fail
- -action -print FTP open connection failed with error:
- -action -print %TG.LAST_ERROR%
- -action -return abort
- }
-
- # operation failed
- {
- -name operation_fail
- -action -print FTP get failed with error:
- -action -print %TG.LAST_ERROR%
- -action -print Closing connection.
- -action -ftp close handle
- -action -return abort
- }
-